package com.gylang.mail.message;

import com.gylang.mail.service.SendMailService;
import com.gylang.common.model.mail.MailBean;
import com.gylang.common.model.mail.TemplateMailBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MailReceive {

    @Autowired
    private SendMailService sendMailService;

    @RabbitListener(queuesToDeclare =@Queue( "dfMail"))
    public void sendDfMail(MailBean mailBean) {

        System.out.println(mailBean);
        sendMailService.simpleMail(mailBean);
    }
    @RabbitListener(queuesToDeclare =@Queue( "templateMail"))
    public void sendTemplateMail(TemplateMailBean mailBean) {

        System.out.println(mailBean);
        sendMailService.templateMail(mailBean);
    }

}
